//frontend/src/router/guards.js
export const requireAuthGuard = (to, from, next) => {
    const isAuthenticated = localStorage.getItem('token');
    if (to.meta.requiresAuth && !isAuthenticated && to.path !== '/login') {
        next('/login'); // 如果未登录，跳转到登录页面
    } else {
        next(); // 继续访问
    }
};
